/*
 *2_member.cpp
 *Create by Administrator
 * 2017年3月23日
 * 下午1:20:11
 * C++ 类成员函数
 */
#include <iostream>

using std::cout;
using std::endl;

class Box {
public:
	double length, breadth, height;

	//成员函数声明
	double getVolume(void);
	void setLength(double len);
	void setBreadth(double bre);
	void setHeight(double hei);
};

//成员函数定义
double Box::getVolume(void) {
	return length * breadth * height;
}

void Box::setLength(double len) {
	length = len;
}
void Box::setBreadth(double bre) {
	breadth = bre;
}

void Box::setHeight(double hei) {
	height = hei;
}

int main() {
    Box box1,box2; // 声明 Box1，类型为 Box
    double volume = 0.0;

    //box1
    box1.setLength(6.0);
    box1.setBreadth(7.0);
    box1.setHeight(5.0);

    //box2
    box2.setLength(12.0);
    box2.setBreadth(13.0);
    box2.setHeight(10.0);


	cout << " box1的体积"<<box1.getVolume() << endl;
	cout << " box2的体积"<<box2.getVolume() << endl;

	return 0;
}
